﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK.Audio;

namespace Lichtspiel.Audio
{
    public class AudioCore : IDisposable
    {
        private bool disposed = false;
        private AudioContext context;
        private Game game;

        internal AudioCore(Game game) {
            this.game = game;

            context = new AudioContext(); // TODO fehler abfangen und irgendwo ablegen
        }

        #region IDisposable Members

        public void Dispose() {
            Dispose(true);
        }

        private void Dispose(bool disposing) {
            // If you need thread safety, use a lock around these 
            // operations, as well as in your methods that use the resource.
            if (!disposed) {
                if (disposing) {
                    if (context != null) {
                        context.Dispose();
                    }
                }

                // Indicate that the instance has been disposed.
                context = null;
                disposed = true;
            }
        }

        #endregion
    }
}
